package cn.com.sise.service.impl;

import cn.com.sise.dao.DictionaryDao;
import cn.com.sise.pojo.Dictionary;
import cn.com.sise.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryServiceImpl implements DictionaryService {
    private DictionaryDao dictionaryDao;

    @Autowired
    public void setDictionaryDao(DictionaryDao dictionaryDao) {
        this.dictionaryDao = dictionaryDao;
    }

    //    增加单词
    public int insertDictionary(Dictionary dictionary) {
        return dictionaryDao.insertDictionary(dictionary);
    }

    //    通过id删除单词信息
    public void deleteDictionary(Dictionary dictionary) {
        dictionaryDao.deleteDictionary(dictionary);
    }

    //    通过id修改单词信息
    public int updateDictionary(Dictionary dictionary) {
        return dictionaryDao.updateDictionary(dictionary);
    }

    //    通过id修改单词所有信息
    public Dictionary selectDictionary(Dictionary dictionary) {
        return dictionaryDao.selectDictionary(dictionary);
    }

    //    获取词库中的单词数
    public int getDictionaryTotal() {
        return dictionaryDao.getDictionaryTotal();
    }

    public List<Dictionary> getDictionaryList(int start, int count) {
        return dictionaryDao.getDictionaryList(start, count);
    }

    public List<Dictionary> getListLike(String wordLike, int start, int count) {
        return dictionaryDao.getListLike(wordLike, start, count);
    }

    public int getLikeTotal(String likeTotalDic) {
        return dictionaryDao.getLikeTotal(likeTotalDic);
    }

    public Dictionary getDictionaryByWordTranLike(Dictionary dictionary) {
        return dictionaryDao.getDictionaryByWordTranLike(dictionary);
    }

    public Dictionary getDictionaryByWord(Dictionary dictionary) {
        return dictionaryDao.getDictionaryByWord(dictionary);
    }
}
